<!--
 * @Author: your name
 * @Date: 2020-01-20 10:49:00
 * @LastEditTime: 2020-04-20 16:39:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jd-jdp-front\src\components\OSS\Announcements.vue
 -->
<template>
  <div class="content">
    <div class="title">公告管理</div>
    <div class="items">
      <el-input
        type="textarea"
        placeholder="请输入内容"
        v-model="filingAnnouncementVO.announcementInfo"
        maxlength="50"
        rows="10"
        show-word-limit
      ></el-input>
    </div>
    <el-button class="enter" @click="enter">确认发布</el-button>
  </div>
</template>

<script>
export default {
  name: 'Announcements',
  data() {
    return {
      filingAnnouncementVO: {},
      notice: 'TEST NOTICE'
    }
  },
  mounted() {
    this.queryAnnouncementInfo()
  },
  methods: {
    //查询公告信息
    queryAnnouncementInfo() {
      this.$axios
        .get('/api/manage/announcement/queryAnnouncementInfo')
        .then(resp => {
          this.filingAnnouncementVO = resp.result
        })
    },
    enter() {
      const _this = this
      _this.$axios
        .post(
          '/api/manage/announcement/updateAnnouncementInfo',
          _this.filingAnnouncementVO
        )
        .then(resp => {
          if (resp.success) {
            _this.$message({
              message: '发布成功',
              type: 'success'
            })
          } else {
            _this.$message({
              message: '发布失败',
              type: 'error'
            })
          }
        })
    }
  }
}
</script>

<style lang="less" scoped>
@themeColor:#298DF8;
.title {
  height: 50px;
  border: 1px solid #bbbbbb;
  margin: 5px auto 0;
  padding: 16px 10px;
  background-color: #f3f3f3;
  font-weight: bold;
}

.content {
  width: 70%;
  margin: 0px auto;
  height: 400px;
}

.enter {
  margin-top: 10px;
  float: right;
  background-color: @themeColor;
  color: #ffffff;
  border-radius: 5px;
}
</style>